<template>
  <view class="box">
    <!-- 轮播区域 -->
    <u-swiper
      style="margin-top: 35rpx"
      :list="data.carousel_img"
      @change="(e) => (current = e.current)"
      :autoplay="true"
	    keyName="file_url"
      @click="goWebView"
    >
      <view slot="indicator" class="indicator">
        <view
          class="indicator__dot"
          v-for="(item, index) in data.carousel_img"
          :key="index"
          :class="[index === current && 'indicator__dot--active']"
        >
        </view>
      </view>
    </u-swiper>
    <!-- 金刚区 -->
    <view class="diamond">
      <view
        class="diamond_item"
        v-for="(item, index) in data.diamond"
        @click="toUrl(item.url)"
      >
        <image :src="item.img_url" mode=""></image>
        <text>{{ item.name }}</text>
      </view>
    </view>
    <!-- 今日更新 -->
    <todayRenew :jinriList="data.jinri" :my_level_id="my_level_id"></todayRenew>
	  <start ></start>
    <!-- 星云共创 -->
    <coCreate :list="data.gongchuang"></coCreate>
	
    <view style="height:50rpx"></view>
  </view>
</template>

<script>
import todayRenew from "./todayRenew.vue";
import coCreate from "./coCreate.vue";
import start from './homeStart.vue'
export default {
  components: {
    todayRenew,
    coCreate,
	start
  },
  props: {
    data: {
      type: Object,
      default: {},
    },
    my_level_id:{
      type:Number,
      default:0
    }
  },
  data() {
    return {
      list5: [
        "https://cdn.uviewui.com/uview/swiper/swiper3.png",
        "https://cdn.uviewui.com/uview/swiper/swiper2.png",
        "https://cdn.uviewui.com/uview/swiper/swiper1.png",
      ],
      current: 0,
      diamondList: [
        {
          img: "../../static/images/icon_jgq_one.png",
          name: "山海",
		  url: "/pages/index/index",
        },
        {
          img: "../../static/images/icon_jgq_one.png",
          name: "奥义",
		  url: "/pages/stargate/Tianwen",
        },
        {
          img: "../../static/images/icon_jgq_one.png",
          name: "导航",
		  url: "/pages/stargate/Tianxing",
        },
        {
          img: "../../static/images/icon_jgq_one.png",
          name: "星河",
          url: "/pages/distinguish/galaxy",
        },
        {
          img: "../../static/images/icon_jgq_one.png",
          name: "大成",
          url: "/pages/bigResult/bigResult",
        },
        {
          img: "../../static/images/icon_jgq_one.png",
          name: "书院",
          url: "/pages/bookAcademy/index",
        },
        {
          img: "../../static/images/icon_jgq_one.png",
          name: "一田",
          url: "/pages/field/index",
        },
        {
          img: "../../static/images/icon_jgq_one.png",
          name: "人物",
          url: "/pages/character/index",
        },
        {
          img: "../../static/images/icon_jgq_one.png",
          name: "图书",
          url: "/pages/book/index",
        },
        {
          img: "../../static/images/icon_jgq_one.png",
          name: "行者",
          url: "/pages/member/index",
        },
      ],
    };
  },
  created() {
    
  },
  methods: {
    change() {},
    toUrl(url) {
      uni.navigateTo({
        url,
      });
    },
    click() {},
    goWebView(index){
      console.log(this.data.carousel_img[index].url,'5656565656565')
      // plus.runtime.openURL(&#39;this.data.carousel_img[index].url)
      // uni.navigateTo({
      //   url: `/components/webview?url=${this.data.carousel_img[index].url}`
      // });
      plus.runtime.openURL(this.data.carousel_img[index].url, function() {
        console.log('Open URL success:', this.data.carousel_img[index].url);
      }, function(error) {
        console.error('Open URL failed:', error);
      });
    }
  },
};
</script>

<style scoped lang="scss">
.box {
  width: 100%;
  padding: 0 30rpx 56rpx;
  box-sizing: border-box;
}
.diamond {
  width: 100%;
  margin-top: 16rpx;
  display: flex;
  flex-wrap: wrap;
  .diamond_item {
    width: 20%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 24rpx;
    image {
      width: 80rpx;
      height: 80rpx;
    }
    text {
      margin-top: 12rpx;
      font-size: 24rpx;
      color: #eeeeee;
      font-family: PingFang SC-Medium, PingFang SC;
    }
  }
}
.indicator {
  @include flex(row);
  justify-content: center;

  &__dot {
    height: 6px;
    width: 6px;
    border-radius: 100px;
    background-color: rgba(255, 255, 255, 0.35);
    margin: 0 5px;
    transition: background-color 0.3s;

    &--active {
      background-color: #ffffff;
    }
  }
}
</style>